// Copyright 2021 Datafuse Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

fn main() {
    divan::main()
}

// bench                     fastest       │ slowest       │ median        │ mean          │ samples │ iters
// ╰─ dummy                                │               │               │               │         │
// ├─ deep_function_call  81.55 µs      │ 290.1 µs      │ 91.42 µs      │ 94.28 µs      │ 100     │ 100
// ├─ deep_query          237.3 µs      │ 460.7 µs      │ 250.4 µs      │ 255.7 µs      │ 100     │ 100
// ├─ large_query         150.1 µs      │ 282.1 µs      │ 163.9 µs      │ 167 µs        │ 100     │ 100
// ├─ large_statement     149.7 µs      │ 185.4 µs      │ 161.4 µs      │ 161.8 µs      │ 100     │ 100
// ├─ wide_embedding      2.435 ms      │ 2.8 ms        │ 2.503 ms      │ 2.514 ms      │ 100     │ 100
// ╰─ wide_expr           30.73 µs      │ 45.14 µs      │ 31.18 µs      │ 31.78 µs      │ 100     │ 100

#[divan::bench_group(max_time = 0.5)]
mod dummy {
    use databend_common_ast::parser::parse_expr;
    use databend_common_ast::parser::parse_sql;
    use databend_common_ast::parser::tokenize_sql;
    use databend_common_ast::parser::Dialect;

    #[divan::bench]
    fn large_statement() {
        let case = r#"explain SELECT SUM(count) FROM (SELECT ((((((((((((true)and(true)))or((('614')like('998831')))))or(false)))and((true IN (true, true, (-1014651046 NOT BETWEEN -1098711288 AND -1158262473))))))or((('780820706')=('')))) IS NOT NULL AND ((((((((((true)AND(true)))or((('614')like('998831')))))or(false)))and((true IN (true, true, (-1014651046 NOT BETWEEN -1098711288 AND -1158262473))))))OR((('780820706')=(''))))) ::INT64)as count FROM t0) as res;"#;
        let tokens = tokenize_sql(case).unwrap();
        let (stmt, _) = parse_sql(&tokens, Dialect::PostgreSQL).unwrap();
        divan::black_box(stmt);
    }

    #[divan::bench]
    fn large_query() {
        let case = r#"SELECT SUM(count) FROM (SELECT ((((((((((((true)and(true)))or((('614')like('998831')))))or(false)))and((true IN (true, true, (-1014651046 NOT BETWEEN -1098711288 AND -1158262473))))))or((('780820706')=('')))) IS NOT NULL AND ((((((((((true)AND(true)))or((('614')like('998831')))))or(false)))and((true IN (true, true, (-1014651046 NOT BETWEEN -1098711288 AND -1158262473))))))OR((('780820706')=(''))))) ::INT64)as count FROM t0) as res;"#;
        let tokens = tokenize_sql(case).unwrap();
        let (stmt, _) = parse_sql(&tokens, Dialect::PostgreSQL).unwrap();
        divan::black_box(stmt);
    }

    #[divan::bench]
    fn deep_query() {
        let case = r#"SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers UNION ALL SELECT * FROM numbers"#;
        let tokens = tokenize_sql(case).unwrap();
        let (stmt, _) = parse_sql(&tokens, Dialect::PostgreSQL).unwrap();
        divan::black_box(stmt);
    }

    #[divan::bench]
    fn wide_expr() {
        let case = r#"a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a AND a"#;
        let tokens = tokenize_sql(case).unwrap();
        let expr = parse_expr(&tokens, Dialect::PostgreSQL).unwrap();
        divan::black_box(expr);
    }

    #[divan::bench]
    fn deep_function_call() {
        let case = r#"json_object_insert(json_object_insert(json_object_insert(json_object_insert(json_object_insert(json_object_insert(json_object_insert(json_object_insert(json_object_insert(json_object_insert(json_object_insert(json_object_insert(json_object_insert(json_object_insert(json_object_insert(json_object_insert(json_object_insert(json_object_insert('{}'::variant, 'email_address', 'gokul', true), 'home_phone', 12345, true), 'mobile_phone', 345678, true), 'race_code', 'M', true), 'race_desc', 'm', true), 'marital_status_code', 'y', true), 'marital_status_desc', 'yu', true), 'prefix', 'hj', true), 'first_name', 'g', true), 'last_name', 'p', true), 'deceased_date', '2085-05-07', true), 'birth_date', '6789', true), 'middle_name', '89', true), 'middle_initial', '0789', true), 'gender_code', '56789', true), 'gender_desc', 'm', true), 'home_phone_line_type', 'uyt', true), 'mobile_phone_line_type', 4, true)"#;
        let tokens = tokenize_sql(case).unwrap();
        let expr = parse_expr(&tokens, Dialect::PostgreSQL).unwrap();
        divan::black_box(expr);
    }

    #[divan::bench]
    fn wide_embedding() {
        let case = r#"cosine_distance(embedding, [0.01603204570710659, -0.015531889162957668, 0.011922650970518589, -0.03914738819003105, -0.015275051817297935, 0.041202086955308914, -0.00041524821426719427, 0.013767823576927185, -0.008347207680344582, -0.0045554800890386105, -0.012064587324857712, -0.015193945728242397, -0.01120621059089899, -0.011963204480707645, -0.0003058389702346176, 0.00012799614341929555, 0.03520020842552185, -0.013686716556549072, 0.0024281248915940523, -0.0016457854071632028, -0.03209112584590912, 0.026346085593104362, 0.004193880595266819, 0.004663622006773949, 0.026332566514611244, 0.004339196253567934, 0.021331001073122025, -0.004856249783188105, 0.013734028674662113, -0.003283122321590781, 0.020722702145576477, -0.006529070902615786, 0.0037410359364002943, -0.023034237325191498, -0.03744415193796158, -0.028982045128941536, -0.008800052106380463, -0.01226735394448042, 0.012510673142969608, -0.01237549539655447, 0.025061899796128273, -0.014964143745601177, -0.003229051362723112, -0.015518371015787125, 0.01133462879806757, -0.007549660746008158, -0.06191127002239227, 0.016937734559178352, -0.01592390425503254, 0.010503287427127361, -0.00023001288354862481, -0.0014937107916921377, -0.036660123616456985, 0.013402843847870827, 0.003078666515648365, 0.0011219728039577603, 0.007434759754687548, 0.01616722345352173, 0.002958696335554123, -0.030387891456484795, 0.0008604889735579491, 0.00894874706864357, -0.010706054046750069, 0.022466491907835007, -0.012226800434291363, 0.018573381006717682, -0.012977034784853458, -0.008583768270909786, -0.01732974871993065, -0.00694136181846261, 0.020884916186332703, 0.016126669943332672, -0.00696839764714241, 0.012449842877686024, 0.018032671883702278, -0.016315918415784836, -0.033307723701000214, 0.007218475919216871, -0.014883036725223064, 0.004427061416208744, -0.008333689533174038, -0.014788413420319557, -0.02787359058856964, 0.04255386069417, 0.018803182989358902, 0.01893836073577404, 0.0001457381877116859, 0.018546346575021744, -0.007434759754687548, -0.0048934235237538815, 0.026900311931967735, 0.01364616397768259, 0.011645536869764328, -0.004535203333944082, -0.0012858754489570856, 0.012645849958062172, -0.02218261919915676, 0.006657489575445652, -0.016816074028611183, -0.0092393783852458, -0.006921085529029369, 0.004775143228471279, -0.002711997600272298, -0.007083298172801733, -0.029333505779504776, -0.014369362965226173, -0.0010602980619296432, 0.006927844136953354, 0.013342014513909817, -0.04360824450850487, -0.006772390101104975, 0.015491335652768612, 0.00725902896374464, -0.028657618910074234, 0.0203442070633173, -0.029252400621771812, 0.008604045026004314, 0.026210907846689224, 0.017032358795404434, -0.015139874070882797, 0.030766388401389122, 0.02393992617726326, 0.012699921615421772, -0.02302072010934353, -0.0024129175581038, 0.009732776321470737, -0.01987108588218689, -0.009367797523736954, 0.016586273908615112, -0.004954253323376179, -0.01364616397768259, -0.0032053953036665916, 0.005038739647716284, 0.004761625546962023, -0.0066811456345021725, -0.0013965520774945617, -0.006069467402994633, 0.003974216990172863, -0.003129357937723398, -0.04041805863380432, 0.008387761190533638, 0.00252612866461277, -0.0014024660922586918, -0.0002338147460250184, 0.01395031251013279, 0.02137155458331108, 0.031334131956100464, -0.0012292698957026005, 0.017343265935778618, 0.004356093239039183, 0.017343265935778618, 0.004869767464697361, 0.018275991082191467, -0.010942614637315273, 0.0041431887075304985, 0.0017252021934837103, -0.005126604810357094, 0.009894989430904388, -0.03730897605419159, -0.01377458218485117, 0.016532201319932938, 0.01190913375467062, -0.01904650218784809, -0.0044507174752652645, 0.0006944741471670568, 0.017951564863324165, 0.0011819577775895596, 0.007117092609405518, -0.02534577250480652, 0.02077677473425865, 0.017965083941817284, 0.02311534434556961, -0.023534394800662994, 0.011260281316936016, -0.002367295091971755, 0.01458564680069685, -0.03395657613873482, 0.02998235821723938, -0.02427786961197853, -0.006782528478652239, 0.029603861272335052, -0.00484949117526412, 0.012240317650139332, 0.0147478599101305, 0.000327805319102481, -0.0202360637485981, 0.01569410227239132, 0.012801304459571838, 0.028630584478378296, 0.0012275802437216043, 0.001503004226833582, 0.008556732907891273, -0.002074973890557885, 0.0006387134199030697, -0.648851752281189, -0.023182932287454605, 0.015072285197675228, -0.02162839099764824, 0.0022371867671608925, 0.00624519819393754, 0.0033929538913071156, 0.0022490147966891527, -0.03474060446023941, 0.016329435631632805, 0.0030904945451766253, 0.020411795005202293, 0.008529696613550186, 0.009692222811281681, -0.01057763583958149, -0.009949060156941414, 0.0037072414997965097, -0.016342952847480774, 0.002674823859706521, -0.015139874070882797, -0.03044196218252182, 0.026170354336500168, 0.004454096779227257, -0.01988460309803486, 0.01214569341391325, 0.019208716228604317, 0.009394832886755466, -0.023615499958395958, -0.027468057349324226, 0.007002192083746195, 0.0031040122266858816, 0.02089843340218067, 0.005843045189976692, 0.029603861272335052, 0.05882922559976578, 0.015748172998428345, -0.03146931156516075, 0.011746920645236969, -0.00044524073018692434, 0.04450041800737381, -0.027562681585550308, -0.015626512467861176, 0.0154643002897501, -0.00432905787602067, -0.02046586573123932, 0.014044936746358871, 0.011233245953917503, -0.001311221276409924, -0.0010780401062220335, 0.003991113975644112, -0.001809688052162528, 0.0011675952700898051, -0.008435073308646679, -0.010219414718449116, 0.004099256359040737, -0.01626184768974781, 0.019925156608223915, -0.023209968581795692, 0.006052570417523384, 0.027373433113098145, -0.00795519258826971, 0.00595118710771203, -0.006319545675069094, -0.004349334631115198, -0.033172547817230225, 0.008827087469398975, -0.010658741928637028, -0.007684838026762009, 0.04058026894927025, -0.015126356855034828, 0.02707604318857193, 0.016315918415784836, -0.018208403140306473, -0.0051130871288478374, 0.0018401030683889985, 0.022601669654250145, 0.003524752100929618, -0.02499430999159813, 0.005964704789221287, 0.004447338171303272, 0.003132737474516034, -0.040282879024744034, -0.00352813140489161, -0.004639965947717428, 0.014139560982584953, -0.004254710394889116, -0.007015709765255451, 0.02091195061802864, 0.02871168963611126, -0.0034014026168733835, 0.03163152188062668, 0.007103574927896261, -0.002127355197444558, -0.02496727555990219, 0.004771763924509287, -0.008218788541853428, -0.014261220581829548, 0.01098316814750433, -0.012159211561083794, -0.0261568371206522, -0.006556106265634298, 0.00012134288408560678, 0.018167849630117416, -0.00493735633790493, 0.009786847047507763, 0.004298642743378878, -0.01016534399241209, -0.017113465815782547, 0.017289195209741592, -0.015558924525976181, -0.00554565479978919, -0.030982671305537224, -0.016248328611254692, -0.013652922585606575, -6.948965892661363e-05, -0.014950625598430634, -0.013396085239946842, 0.003937043249607086, 0.001566368737258017, -0.009225861169397831, -0.013801617547869682, 0.0012706679990515113, 0.007448277436196804, -0.0027424125000834465, -0.006278992630541325, 0.0006910947267897427, 0.0047582462430000305, -0.014977660961449146, -0.014017901383340359, 0.011294076219201088, 0.023750677704811096, -0.018884290009737015, 0.009766570292413235, -0.0006606797687709332, 0.018654488027095795, 0.014491022564470768, 0.021168788895010948, -0.010090996511280537, 0.016883663833141327, -0.031901877373456955, -0.03684937208890915, 0.0028302778955549, -4.88962177769281e-05, 0.0028353470843285322, -0.022452974691987038, -0.009482698515057564, 0.006921085529029369, 0.00018967085634358227, -0.01382189430296421, 0.00025894929422065616, -0.020952504128217697, -0.016424059867858887, -0.012118658050894737, 0.0030381132382899523, -0.004227674566209316, 0.005630140658468008, 0.00026972126215696335, -0.017802869901061058, -0.003967457916587591, -0.006762251723557711, -0.009888230822980404, 0.020411795005202293, -0.030009394511580467, -0.005491584073752165, 0.0026731339748948812, -0.01476137712597847, 0.012470119632780552, -0.003714000340551138, -0.005021842196583748, -0.021560803055763245, -0.00024838856188580394, -0.0057991123758256435, -0.011713125742971897, -0.017965083941817284, 0.017289195209741592, 0.0028877281583845615, -0.0013467053649947047, 0.006474999710917473, -0.0154643002897501, 0.014612682163715363, 0.007671320345252752, 0.006975156255066395, 0.006877152714878321, -0.00595118710771203, 0.015775207430124283, 0.01718105375766754, 0.01616722345352173, 0.009935542941093445, 0.009604358114302158, 0.013747546821832657, -0.022033924236893654, 0.018343579024076462, -0.008387761190533638, 0.016802556812763214, -0.016207776963710785, -0.0018874151865020394, 0.004910320974886417, 0.012916205450892448, 0.021412108093500137, 0.040147703140974045, 0.004004632122814655, 0.010381627827882767, 0.04985344409942627, -0.015842797234654427, 0.004650104325264692, -0.012240317650139332, -0.002874210476875305, -0.029117222875356674, 0.03698455169796944, -0.008529696613550186, 0.004078979603946209, -0.014666752889752388, -0.0007375619607046247, -0.023547912016510963, 0.011699608527123928, 0.0021983233746141195, -0.0057585593312978745, 0.019343892112374306, -0.0130784185603261, -0.017843423411250114, 0.008691909722983837, 0.008813569322228432, -0.009638152085244656, -0.0037917273584753275, 0.013794858939945698, 0.0095975985750556, -0.00998961366713047, 0.031171919777989388, -0.010969650000333786, -0.006001878529787064, 0.012355218641459942, -0.004302022513002157, 0.012429566122591496, 0.011395459063351154, 0.004332437179982662, 0.0068264612928032875, 0.006701421923935413, -0.016315918415784836, 0.04082359001040459, -0.017924530431628227, 0.014720824547111988, 0.017573067918419838, 0.012071345932781696, -0.008982541970908642, 0.005353027023375034, -0.013436638750135899, 0.0270895604044199, 0.004099256359040737, -0.027332879602909088, -0.010584394447505474, -0.005718006286770105, 0.00737392995506525, 0.031658560037612915, -0.0011202831519767642, 0.026346085593104362, -0.017938047647476196, -0.005467928014695644, 0.00021385494619607925, 0.053395092487335205, 0.025940552353858948, 0.022709811106324196, 0.0012706679990515113, 0.017464926466345787, -0.012889170087873936, -0.0018417927203699946, 0.011746920645236969, 0.008225548081099987, -0.021168788895010948, -0.010192379355430603, -0.0168295931071043, 0.01662682555615902, -0.028387265279889107, -0.010320798493921757, -0.0056706941686570644, 0.010341075249016285, 0.016126669943332672, -0.01659979112446308, -0.029306471347808838, 0.006789287552237511, 0.017018841579556465, -0.0168295931071043, -0.02092546969652176, 0.027495093643665314, 0.003266225103288889, -0.008975782431662083, 0.01812729611992836, 0.007306341081857681, -0.009327244013547897, -0.01883021928369999, -0.005221229046583176, -0.005893736612051725, -0.0009006197797134519, -0.008151200599968433, 0.005657176487147808, 0.032821085304021835, 0.008752739988267422, 0.02602165937423706, -0.004400026053190231, 0.01881670020520687, -0.03314550966024399, -0.0027018592227250338, -0.023331627249717712, -0.016464613378047943, 0.0018417927203699946, 0.031117849051952362, 0.017856940627098083, -0.0022997064515948296, -0.012787786312401295, -0.012294389307498932, -0.01284861657768488, -0.005146881565451622, -0.007488830480724573, -0.012111899442970753, 0.011557672172784805, -0.0037883480545133352, 6.0460224631242454e-05, -0.01628888212144375, -0.02102009393274784, 0.02010088600218296, 0.0037951068952679634, 0.0035010960418730974, -0.017262160778045654, -0.018965397030115128, 0.003173290519043803, 0.11819916218519211, 0.001608611666597426, -0.0216013565659523, 0.02976607345044613, -0.011800991371273994, 0.022682776674628258, -0.00332536525093019, -0.031117849051952362, 0.02380474843084812, 0.0092934500426054, 0.02207447774708271, 0.011233245953917503, 0.004785281606018543, -0.030955635011196136, 0.015829280018806458, 0.01708642952144146, -0.021290447562932968, -0.015626512467861176, -0.025507984682917595, -0.0016753554809838533, 0.0029434890020638704, -0.02124989591538906, 0.022750364616513252, 0.028441336005926132, 0.00829989556223154, 0.030604174360632896, 0.02057400718331337, -0.0016457854071632028, 0.02022254653275013, -0.015437264926731586, -0.010557359084486961, -0.002465298632159829, 0.006549347657710314, 0.011821268126368523, 0.00784705113619566, 0.04193204641342163, 0.0023351905401796103, -0.0038931104354560375, 0.012274112552404404, 0.0016297331312671304, 0.03455135598778725, 0.02416972815990448, -0.006069467402994633, -0.019925156608223915, 0.01659979112446308, -0.033280689269304276, 0.004281745757907629, 0.024467118084430695, -0.009671946056187153, -0.01732974871993065, 0.046879541128873825, 0.0030296645127236843, 0.009462421759963036, 0.002314913785085082, 0.014436951838433743, -0.009320485405623913, 0.011956444941461086, 0.021276930347085, 0.01023293286561966, -0.009888230822980404, -0.01709994673728943, -0.01812729611992836, -0.01104399748146534, -0.01939796470105648, -0.028873903676867485, -0.022696293890476227, -0.033632148057222366, 0.01718105375766754, -0.008671632967889309, 0.004957633092999458, -0.01091557927429676, -0.01753251440823078, -0.019019467756152153, -0.004673760384321213, 0.0052584027871489525, 0.015518371015787125, 0.029603861272335052, -0.012341701425611973, 0.013754305429756641, 0.018208403140306473, 0.004940735641866922, -0.016424059867858887, 0.0023335006553679705, -0.0038322806358337402, -0.0029485581908375025, 0.015423746779561043, 0.003771450836211443, -0.004771763924509287, 0.017586586996912956, 0.014436951838433743, 0.02521059475839138, 0.008914953097701073, 0.0168295931071043, -0.025061899796128273, -0.00028450629906728864, -0.0036362733226269484, 0.02233131416141987, 0.03379436209797859, -0.0037410359364002943, -0.012517431750893593, 0.00047523321700282395, 0.013639404438436031, 0.014869519509375095, -0.03068528138101101, 0.03484874591231346, -0.009847677312791348, -0.0011135241948068142, 0.020601043477654457, -0.01592390425503254, 0.004190500825643539, 0.002000626176595688, 0.004136430099606514, 0.02150673232972622, -0.0034132306464016438, 0.014328809455037117, 0.020411795005202293, 0.004051944240927696, 0.007752426899969578, 0.012301147915422916, -0.008245824836194515, 0.008928470313549042, -0.025413360446691513, 0.04787985235452652, 0.01628888212144375, -0.01928982138633728, 0.03455135598778725, -0.01673496887087822, 0.012186246924102306, -0.008002504706382751, -0.017464926466345787, -0.017032358795404434, 0.027251774445176125, -0.014653235673904419, -0.017505479976534843, -0.02683272399008274, -0.02906315214931965, -0.004592653829604387, 0.013004071079194546, -0.015491335652768612, -0.009908506646752357, -0.031225990504026413, 0.007063021883368492, 0.010962891392409801, 0.0031513243447989225, 0.012774269096553326, -0.026886794716119766, -0.010618188418447971, 0.03303736820816994, 0.008637838996946812, 0.0413372628390789, -0.0261568371206522, -0.03682233765721321, 0.0011659055016934872, 0.014504540711641312, -0.028279121965169907, -0.029360542073845863, 0.008381001651287079, 0.0075766961090266705, 0.03382139652967453, -0.006910947151482105, 0.01719457097351551, -0.0024348837323486805, 0.014274738729000092, -0.003879592753946781, 0.014788413420319557, -0.0060187759809195995, -0.004974530078470707, 0.010239691473543644, -0.015775207430124283, 0.021763568744063377, 0.012341701425611973, 0.010320798493921757, 0.011821268126368523, 0.009820641949772835, -0.006481758784502745, 0.002612304175272584, -0.0052009522914886475, -0.044581521302461624, -0.01719457097351551, -0.009462421759963036, 0.00773215014487505, -0.00423781294375658, -0.008908193558454514, 0.0017894115298986435, 0.0060965027660131454, 0.014504540711641312, 0.0585588701069355, 0.015383194200694561, 0.011077792383730412, -0.00946918036788702, 0.0157887265086174, -0.011138621717691422, 0.018532827496528625, 0.015058767981827259, -0.013206836767494678, 0.007657802663743496, -0.021587839350104332, -0.035740919411182404, 0.015585959888994694, -0.003120909444987774, 0.013281184248626232, -0.013781340792775154, -1.8454889868735336e-05, -0.024467118084430695, -0.035037994384765625, 0.012253835797309875, -0.012997311539947987, -0.034118786454200745, 0.018519310280680656, -0.023777713999152184, -0.001063677598722279, -0.027170667424798012, -0.02857651188969612, -0.013524503447115421, 0.00525502348318696, -0.012862134724855423, -0.003666688222438097, -0.005305714905261993, 0.0016246639424934983, -0.01451805792748928, 0.017221607267856598, -0.03233444690704346, 0.0174378901720047, 0.012111899442970753, 0.002250704448670149, 0.010300521738827229, 0.0015418677357956767, -0.01719457097351551, 0.041202086955308914, 0.02811690978705883, 0.006691283546388149, 0.021655427291989326, 0.025305218994617462, -0.0035044753458350897, -0.02683272399008274, 0.008556732907891273, 0.009922024793922901, -0.005133363418281078, -0.02253408171236515, 0.016315918415784836, 0.011672573164105415, -0.007400965318083763, -0.007292823400348425, 0.011192692443728447, -0.011625261045992374, 0.0068534966558218, 0.015896867960691452, -0.012902687303721905, -0.0021256653126329184, -0.0011321111815050244, -0.01778935268521309, 0.015248016454279423, -0.009746294468641281, 0.013632645830512047, 0.004525064956396818, -0.019330374896526337, -0.016883663833141327, -0.008381001651287079, 0.008935229852795601, 0.010949373245239258, -0.0063837552443146706, 0.010618188418447971, -0.011077792383730412, 0.0016263537108898163, -0.016221294179558754, 0.00048072481877170503, -0.02754916436970234, -0.008975782431662083, 0.0012858754489570856, 0.02683272399008274, -0.011307593435049057, 0.007184681482613087, -0.02963089756667614, 0.02857651188969612, -0.024602295830845833, 0.014301774092018604, -0.01185506209731102, -0.002607234986498952, -0.002517679939046502, -0.01214569341391325, 0.018330061808228493, 0.018154330551624298, -0.010246451012790203, -0.0033608493395149708, 0.0005132518708705902, -0.009016335941851139, -0.008894676342606544, -0.01777583546936512, -0.011016962118446827, -0.007711873389780521, -0.02462933212518692, -0.0016204396961256862, -0.006177609320729971, 0.004741349257528782, 0.020628077909350395, 0.0014371052384376526, -0.019573694095015526, 0.0037477947771549225, 0.007684838026762009, 0.0054611689411103725, -0.009949060156941414, -6.653265154454857e-05, -0.016126669943332672, 0.0008296516025438905, -0.014044936746358871, 0.0019938673358410597, 0.024453600868582726, -0.004761625546962023, -0.04639289900660515, -0.04020177200436592, 0.013227113522589207, 0.017992118373513222, -0.01179423276335001, -0.023507358506321907, 0.009685464203357697, 0.014653235673904419, 0.02115527167916298, -0.005511860363185406, -0.042932357639074326, 0.02358846552670002, -0.031090812757611275, -0.0046433452516794205, -0.0011363354278728366, -0.020492902025580406, 0.020506419241428375, 0.005119845736771822, 0.005778836086392403, 0.008671632967889309, -0.029441649094223976, -0.029360542073845863, -0.010530323721468449, 0.009232619777321815, -0.03265887126326561, -0.020857879891991615, 0.016572754830121994, -0.030306784436106682, -0.002777896588668227, 0.010327557101845741, -0.011429253034293652, 0.0014506230363622308, -0.006495276466012001, 0.002270981203764677, 0.0059038749895989895, 0.014896554872393608, -0.0078943632543087, 0.011618501506745815, -0.01260529737919569, 0.008752739988267422, -0.05139446631073952, -0.005498342681676149, -0.009854435920715332, 0.02139859087765217, 0.022844988852739334, -0.010733089409768581, -0.030820459127426147, -0.032821085304021835, -0.06310082972049713, -0.014031419530510902, -0.01539671141654253, -0.002223669085651636, 0.015072285197675228, 0.014207149855792522, 0.009590839967131615, -0.011848303489387035, -0.009766570292413235, 0.009462421759963036, -0.03763340041041374, -0.011949686333537102, -0.007448277436196804, -0.006796046160161495, 0.025399843230843544, -0.02185819298028946, -0.044554486870765686, -0.023723643273115158, -0.007705114781856537, 0.003960699308663607, 0.01383541151881218, 0.014477504417300224, -0.033388830721378326, 0.008651357144117355, -9.367374877911061e-05, 0.020749738439917564, 0.0057991123758256435, 0.033632148057222366, -0.0013695164816454053, -0.020587526261806488, -0.01045597530901432, 0.00818499457091093, 0.010746607556939125, -0.011463047936558723, -0.0039032488130033016, 0.013565056957304478, -0.011199451982975006, 0.039688099175691605, 0.01601852849125862, -0.004606171511113644, 0.005413856822997332, -0.001509763184003532, 0.0050083245150744915, 0.00042644262430258095, -0.00586332194507122, 0.003379436209797859, 0.012990552932024002, -0.008036299608647823, -0.003676826599985361, 0.010374869219958782, -0.008401278406381607, 0.01766769215464592, 0.0015756621723994613, -0.014720824547111988, 0.022290760651230812, -0.017113465815782547, 0.012706680223345757, -0.01045597530901432, -0.01962776482105255, -0.0020023160614073277, 0.01581576094031334, -0.012206523679196835, 0.017275677993893623, 0.0015215912135317922, -0.025480948388576508, -0.02114175260066986, 0.003060079412534833, -0.007035986054688692, 0.02787359058856964, -0.030739352107048035, 0.006167470943182707, -0.003274673828855157, 0.006126917898654938, 0.009273173287510872, -0.0184787567704916, -0.006478379480540752, 0.021466178819537163, 0.0038998695090413094, -0.002216910244897008, 0.018181366845965385, 0.21390479803085327, -0.01741085574030876, 0.005893736612051725, -0.007657802663743496, -0.0035382697824388742, 0.008725704625248909, -0.010902061127126217, 0.014977660961449146, -0.014477504417300224, 0.01884373649954796, -0.002004005713388324, -0.006731837056577206, -0.00514012249186635, 0.0039032488130033016, 0.005535516422241926, -0.0350920669734478, -0.007833532989025116, -0.005437512882053852, -0.013146006502211094, -0.001560454722493887, 0.010300521738827229, -0.01051004696637392, 0.009658428840339184, 0.0006285751587711275, 0.03228037431836128, 0.018803182989358902, -0.002453470602631569, -0.001361067988909781, 0.012591779232025146, 0.021885229274630547, -0.01789749413728714, 0.01284861657768488, 0.005626761354506016, -0.012679644860327244, 0.01638350635766983, -0.006637212820351124, 0.0022828092332929373, -0.014558611437678337, 0.0054037184454500675, -0.004933977033942938, 0.025143004953861237, -0.018789665773510933, 0.006586521398276091, 0.004379749298095703, -0.00942186824977398, 0.03384843468666077, 0.006981915328651667, 0.00035526324063539505, 0.0001783708721632138, 0.03238851577043533, -0.05063747242093086, 0.0026460986118763685, 0.003107391530647874, 0.006809563841670752, 0.0051130871288478374, 0.006694663316011429, 0.0032881915103644133, -0.015058767981827259, -0.007563178427517414, 0.032956261187791824, -0.007225234527140856, 0.035632774233818054, -0.0012174418661743402, 0.028738725930452347, -0.018424686044454575, 0.010543840937316418, 0.0033422624692320824, 0.007975469343364239, 0.01318656001240015, -0.010881784372031689, 0.00630940729752183, -0.009002817794680595, 0.004690657369792461, 0.015072285197675228, 0.002054697135463357, -0.022250209003686905, 0.009976095519959927, 0.012179488316178322, 0.0216013565659523, -0.0023909511510282755, 0.0058464244939386845, -0.009881471283733845, -0.012639091350138187, -0.015383194200694561, -0.006295889616012573, -0.0502319410443306, 0.017870459705591202, -0.005011703819036484, 0.014937108382582664, -0.02266925759613514, 0.010131550021469593, 0.011659055016934872, -0.001459916471503675, -0.023399217054247856, 0.010185620747506618, 0.005778836086392403, -0.008130923844873905, 0.02427786961197853, -0.013990866020321846, 0.0032577766105532646, 0.004944115411490202, 0.04523037374019623, 0.008962265215814114, -0.006556106265634298, -0.02358846552670002, 0.028333192691206932, -0.006613556761294603, 0.028279121965169907, 0.006184368394315243, 0.0010856438893824816, 0.016329435631632805, -0.04915051907300949, -0.004606171511113644, -0.01605908013880253, 0.00807009357959032, 0.010354592464864254, 0.01778935268521309, -0.027103079482913017, 0.033767327666282654, -0.000505225732922554, 0.0015680583892390132, -0.020411795005202293, 0.005995119921863079, 0.021925782784819603, -0.0012960138265043497, -0.023534394800662994, -0.036200519651174545, 0.0005922461859881878, -0.011260281316936016, -0.01973590813577175, 0.004744728561490774, -0.0018451721407473087, 0.003169911215081811, -0.0008283843053504825, 0.004058702848851681, -0.009949060156941414, -0.016437577083706856, -0.019452035427093506, 0.006718319375067949, 0.01528856996446848, 0.015315605327486992, 0.009475938975811005, 0.01103048026561737, -0.0023537774104624987, -0.002012454206123948, -0.007624008227139711, 0.026521814987063408, -0.00574842095375061, 0.015153392218053341, -0.020290134474635124, -0.002515990287065506, 0.006981915328651667, -0.023723643273115158, 0.001364447409287095, 0.016126669943332672, 0.005413856822997332, -0.005714626517146826, -0.028387265279889107, -0.030496032908558846, 0.019019467756152153, -0.03768747299909592, -0.003474060446023941, 0.05147557333111763, -0.011375182308256626, -0.006397272925823927, 0.009212343022227287, -0.17291899025440216, 0.029928287491202354, 0.005626761354506016, -0.010178862139582634, 0.022966649383306503, 0.0029941804241389036, 0.006039052736014128, -0.014450469054281712, -0.013179801404476166, 0.0005884443526156247, 0.02860354818403721, 0.017478443682193756, -0.005917392671108246, -0.005190813913941383, 0.01927630417048931, -0.003065148601308465, 0.012794545851647854, 0.017978601157665253, 0.011429253034293652, 0.014247703365981579, -0.0037883480545133352, 0.0008921711705625057, 0.0023875716142356396, -0.01481544878333807, 0.01636998914182186, 0.006498655769973993, -0.025197075679898262, -0.007340135518461466, 0.0004676294920500368, -0.0017505480209365487, -0.014910073019564152, 0.004423682112246752, 0.014139560982584953, -0.023155897855758667, 0.008455349132418633, -0.029684968292713165, -0.030766388401389122, -0.006867014337331057, -0.024345459416508675, 0.03160448744893074, 0.0185869000852108, 0.019844049587845802, 0.0026900311931967735, -0.009915266185998917, -0.015383194200694561, 0.005819389130920172, 0.015004697255790234, 0.013673199340701103, -0.015599478036165237, -0.018505793064832687, -0.005072533618658781, -0.008259342052042484, 0.011861821636557579, 0.01709994673728943, -0.025021346285939217, 0.019100572913885117, -0.005782215390354395, 0.015667065978050232, -0.013118971139192581, -0.002113837283104658, 0.01649164967238903, -0.0013712062500417233, 0.021912263706326485, 0.005160399246960878, 0.01731623150408268, -0.022277243435382843, -0.012699921615421772, 0.027711376547813416, -0.014531576074659824, 0.006502035539597273, 0.02591351792216301, -0.02208799496293068, 0.0009513113182038069, -0.017248641699552536, -0.007684838026762009, -0.015139874070882797, -0.014828965999186039, 0.015585959888994694, 0.005947807803750038, -0.008387761190533638, -0.01418011449277401, 0.030171606689691544, -0.02314237877726555, -0.018559863790869713, -0.018573381006717682, -0.03209112584590912, 0.0031428756192326546, -0.005454409867525101, 0.0309286005795002, -0.0010231243213638663, 0.0026376498863101006, -0.03555167093873024, -0.009861194528639317, -0.03195594996213913, 0.007475312799215317, 0.034091752022504807, 0.011280558072030544, -0.012118658050894737, 0.02207447774708271, -0.01628888212144375, 0.005042118951678276, -0.012868893332779408, -0.03146931156516075, 0.022507045418024063, -0.00040658842772245407, -0.007130610290914774, 0.003272983944043517, 0.011659055016934872, 0.0009884850587695837, -0.021547285839915276, -0.009753053076565266, 0.045635905116796494, 0.03192891180515289, 0.0016179051017388701, 0.0076915971003472805, 0.0021510112565010786, -0.006005258299410343, -0.0261568371206522, 0.0021476317197084427, -0.027116596698760986, 0.033388830721378326, 0.027481574565172195, -0.03168559446930885, -0.0350920669734478, 0.014639717526733875, 0.028495406731963158, -0.10327557474374771, -0.01731623150408268, 0.0049204593524336815, 0.0067690107971429825, 0.0025362668093293905, 0.01359885185956955, 0.006954879965633154, 0.012220041826367378, -0.04285125061869621, 0.0274139866232872, -0.016897181048989296, -0.039444778114557266, 0.020519936457276344, -0.006583141628652811, 0.012726956978440285, -0.00010629383177729324, 0.0026292013935744762, -0.037822648882865906, -0.02380474843084812, 0.017518997192382812, 0.0010172103065997362, -0.011976721696555614, -0.02941461279988289, 0.01418011449277401, -0.004775143228471279, -0.025021346285939217, -0.01673496887087822, 0.036092378199100494, 0.021195823326706886, 0.011219728738069534, -0.021412108093500137, -0.0031141506042331457, 0.03403768315911293, -0.02066863141953945, -0.006728457752615213, -0.012713438831269741, -0.021344520151615143, 0.0005385976401157677, 0.024683402851223946, -0.024480635300278664, 0.003521372564136982, -0.004021529108285904, 0.03684937208890915, -0.04604144021868706, 0.02556205540895462, -0.003026285208761692, 0.013963830657303333, 0.0025987864937633276, -0.005984981544315815, -0.004339196253567934, -0.04368935152888298, -0.020425312221050262, -0.010016649030148983, 0.00764428498223424, 0.02685975842177868, -0.0025362668093293905, -0.00511646643280983, 0.01778935268521309, -0.024129174649715424, -0.01916816271841526, 0.02011440508067608, 0.01109130959957838, -0.010719572193920612, -0.0033929538913071156, 0.04787985235452652, -0.020019780844449997, -0.010699295438826084, 0.0022439456079155207, -0.019492588937282562, -0.015437264926731586, -0.012902687303721905, 0.008941988460719585, -0.015275051817297935, -0.004683898761868477, -0.01284861657768488, -0.008908193558454514, -0.02415621094405651, -0.03360511362552643, 0.006248577497899532, -0.015423746779561043, -0.014085490256547928, -0.02779248356819153, 0.013713751919567585, -0.03763340041041374, -0.0022861885372549295, -0.019127609208226204, -0.011125104501843452, -0.007428000681102276, 0.0077794622629880905, -0.019573694095015526, 0.011476565152406693, -0.005353027023375034, 0.009955818764865398, -0.008908193558454514, -0.006839978974312544, 0.021412108093500137, 0.009442145004868507, 0.0012917894637212157, 0.00924613792449236, 0.019479069858789444, -0.021290447562932968, -0.0016516994219273329, -0.06239791214466095, 0.03173966333270073, -0.013538021594285965, -0.01718105375766754, -0.010090996511280537, -0.0019448655657470226, 0.009624633938074112, 0.0002259998000226915, 0.0030364233534783125, -0.00842831376940012, -0.007563178427517414, 0.01800563558936119, 0.0024331940803676844, 0.018262473866343498, -0.014058454893529415, -0.005133363418281078, 0.016870146617293358, -0.016072599217295647, 0.029441649094223976, 0.005511860363185406, -0.012794545851647854, 0.01522098109126091, -0.012091622687876225, 0.000906533794477582, -0.02173653431236744, -0.009840918704867363, -0.02323700301349163, -0.004254710394889116, -0.0027407228481024504, -0.005393580067902803, -0.019587213173508644, 0.004322298802435398, 0.006613556761294603, 0.056882672011852264, 0.000604496628511697, -0.013152766041457653, 0.014099008403718472, 0.04263496771454811, -0.004491270985454321, 0.015410229563713074, -0.03522724285721779, -0.0017708245432004333, 0.017289195209741592, -0.013058141805231571, -0.027630271390080452, 0.021060647442936897, 0.006515553221106529, 0.0015401780838146806, 0.028387265279889107, -0.015829280018806458, 0.02175005152821541, 0.01522098109126091, -0.008124164305627346, -0.010503287427127361, -0.009854435920715332, -0.02077677473425865, 0.013761064037680626, 0.008056576363742352, 0.006894049700349569, -0.04395970702171326, 0.030144570395350456, -0.0024416425731033087, 0.004656862933188677, -0.0056537967175245285, 0.013666439801454544, -0.01649164967238903, 0.022804435342550278, 0.0006378685939125717, -0.003267914755269885, 0.01214569341391325, -0.010226174257695675, -0.0060491906479001045, -0.003521372564136982, 0.010287003591656685, 0.0046129305846989155, -0.012855375185608864, 0.025710750371217728, -0.0048934235237538815, -0.024304905906319618, 0.01388272363692522, -0.007651043590158224, -0.006150573957711458, -0.00037955291918478906, 0.007624008227139711, 0.022452974691987038, -0.01603204570710659, -0.003425058675929904, 0.014328809455037117, 0.013605610467493534, 0.011098068207502365, -0.023966962471604347, 0.010854749009013176, 0.0008338759071193635, -0.003161462489515543, 0.01156443078070879, -0.00039032488712109625, 0.021925782784819603, -0.015653548762202263, 0.007921398617327213, 0.021574320271611214, -0.0010822644690051675, 0.004866388160735369, -0.00525502348318696, -0.04893423616886139, -0.0015384883154183626, -0.007495589554309845, -0.0137069933116436, -0.028170980513095856, -0.0023402594961225986, 0.010138308629393578, 0.023615499958395958, 0.0048731472343206406, 0.016924217343330383, 0.016667379066348076, -0.02210151217877865, 0.01974942535161972, 0.010496528819203377, -0.018640970811247826, -0.0325777642428875, 0.038877032697200775, 0.016424059867858887, -0.018803182989358902, 0.028873903676867485, -0.006995433010160923, -0.010084237903356552, 0.034470248967409134, 0.005102948751300573, -0.012321424670517445, 0.015410229563713074, -0.015977974981069565, 0.02173653431236744, -0.010787160135805607, -0.029009081423282623, -0.010090996511280537, -0.013781340792775154, 0.014396398328244686, 0.004727831110358238, 0.0034808192867785692, -0.014477504417300224, 0.05415208637714386, 0.014477504417300224, -0.005934290122240782, -0.005332750268280506, -0.005778836086392403, 0.02475099079310894, 0.011773956008255482, 0.016505166888237, 0.027981732040643692, -0.02172301523387432, 0.00714412797242403, -0.025710750371217728, 0.019032984972000122, -0.02045234851539135, -0.022507045418024063, 0.002061456209048629, 0.001507228589616716, 0.014369362965226173, -0.008448590524494648, -0.0012225110549479723, 0.02592703513801098, 0.006860255729407072, 0.01731623150408268, -0.00414994778111577, -0.05266513302922249, -0.041202086955308914, 0.007637525908648968, -0.01481544878333807, -0.014639717526733875, -0.03384843468666077, 0.007536142598837614, 0.003171600867062807, -0.02498079277575016, 0.01492359023541212, 0.0013374119298532605, -0.006235059816390276, -0.018884290009737015, -0.009604358114302158, 0.036092378199100494, 0.01435584481805563, -0.011226487345993519, 0.01411252561956644, -0.005650417413562536, -0.011773956008255482, -0.006775769870728254, 0.003027974860742688, -0.008786533959209919, -0.020290134474635124, -0.01528856996446848]::Vector(1536))"#;
        let tokens = tokenize_sql(case).unwrap();
        let expr = parse_expr(&tokens, Dialect::PostgreSQL).unwrap();
        divan::black_box(expr);
    }
}
